//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.isunf.common.utils;

import freemarker.template.Configuration;
import freemarker.template.Template;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Map;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;

public class FreeMarkers {
    public FreeMarkers() {
    }

    public static String renderString(String var0, Map<String, ?> var1) {
        try {
            StringWriter var2 = new StringWriter();
            Template var3 = new Template("name", new StringReader(var0), new Configuration());
            var3.process(var1, var2);
            return var2.toString();
        } catch (Exception e) {
            return e.getMessage();
        }
    }

    public static String renderTemplate(Template var0, Object var1) {
        try {
            StringWriter var2 = new StringWriter();
            var0.process(var1, var2);
            return var2.toString();
        } catch (Exception var3) {
            return var3.getMessage();
        }
    }

    public static Configuration buildConfiguration(String var0) {
        Configuration var1 = new Configuration();
        Resource var2 = (new DefaultResourceLoader()).getResource(var0);
        try {
            var1.setDirectoryForTemplateLoading(var2.getFile());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return var1;
    }

    public static void main(String[] var0) {
    }
}

